<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>后台管理系统</title>
    <meta name="referrer" content="no-referrer" />
    <link
      rel="stylesheet"
      href="https://at.alicdn.com/t/c/font_4755950_cmhps6g8f.css"
    />
    <link rel="stylesheet" href="../style/common.css" />
  </head>

  <body>
    <header class="bg-base flex aic pl-20">
      <h3 class="fff">果莱人才网后台管理系统</h3>
    </header>

    <main class="bg-fff" style="margin-left: 0">
      <div class="pl-30 mb-20 flex jc-sb pr-30">
        <span>修改职位</span>
        <!-- <span class="base cursor">添加</span> -->
      </div>
      <div class="ml-30 form">
        <p class="item mt-10">
          <span>工作类型</span>
          <input
            id="workTitle"
            type="text"
            class="ml-10"
            placeholder="请输入"
          />
        </p>

        <p class="item mt-10">
          <span>工作福利</span>
          <input id="welfare" type="text" class="ml-10" placeholder="请输入" />
        </p>
        <p class="item mt-10">
          <span>工作福利2</span>
          <input id="welfare2" type="text" class="ml-10" placeholder="请输入" />
        </p>
        <p class="item mt-10">
          <span>工作福利3</span>
          <input id="welfare3" type="text" class="ml-10" placeholder="请输入" />
        </p>
        <p class="item mt-10">
          <span>需招人数</span>
          <input
            id="peopleNum"
            type="text"
            class="ml-10"
            placeholder="请输入"
          />
        </p>
      
        <p class="item mt-10">
          <span>热门工作</span>
          <input id="hotMove" type="text" class="ml-10" placeholder="请输入" />
        </p>
        <p class="item mt-10">
          <span>工作地址</span>
          <input id="address" type="text" class="ml-10" placeholder="请输入" />
        </p>
        <p class="item mt-10">
          <span>公司简介</span>
          <input
            id="companyDetail"
            type="text"
            class="ml-10"
            placeholder="请输入"
          />
        </p>

        <p class="item mt-10">
          <span>公司</span>
          <input
            id="companyName"
            type="text"
            class="ml-10"
            placeholder="请输入"
          />
        </p>
        <p class="item mt-10">
          <span>公司logo</span>
          <input
            id="imgUrl"
            type="text"
            class="ml-10"
            placeholder="请输入图片地址"
            value="https://assets2.myjiedian.com/mobile-v2/beta/assets/default_company_logo-718ee4ef.png"
          />
        </p>
        <p class="item mt-30 ml-30 pl-25">
          <button id="submit" class="btn submit ml-30">修改</button>
        </p>
      </div>
    </main>

    <script src="../js/jquery.js"></script>
    <script src="../js/axios.js"></script>
    <script src="../js/common.js"></script>
    <script>
      var editObj = {
        editData() {
          $("#submit").click(function () {
            var webUrl = location.href;
            var index = webUrl.indexOf("=");
            var id = webUrl.slice(index + 1);
            var url = "http://localhost:3000/enterprise/" + id;
           if($('input').val()==''){
            alert('请输入企业完整信息')
           }else{
            var data = {
              imgUrl: $("#imgUrl").val(),
              workType: $("#workTitle").val(),
              companyName: $("#companyName").val(),
              welfare: $("#welfare").val(),
              welfare2: $("#welfare2").val(),
              welfare3: $("#welfare3").val(),
              peopleNum: $("#peopleNum").val(),
              address: $("#address").val(),
              hotMove: $("#hotMove").val(),
              companyDetail: $("#companyDetail").val(),
              // 更新时间
              uTime: common.formateDate(Date.now()),
            };
            axios.patch(url, data).then(function (res) {
              console.log(res);
            });
            location.href = "./list.html";
            alert("修改成功");
           }
          });
        },
      };
      editObj.editData();
    </script>
  </body>
</html>
